package string;
/**
 * String substring(int start,int end)
 * 截取当前字符串中指定范围的字符串(含头不含尾---包含start,但不包含end)*/
public class SubstringDemo {
    public static void main(String[] args) {
        String str = "www.baidu.cn";
        int start = 4;
        int end = 9;
        String name = str.substring(start,end);
        System.out.println(name);//baidu

        int start1 = str.indexOf(".")+1;
        int end1 = str.indexOf(".",start1);
        String name1 = str.substring(start1,end1);
        System.out.println(name1);//baidu
    }
}
